﻿@model IEnumerable<ETL.Business.Models.ProjectActualResourceUsageModel>
<script type="text/javascript">
    $(function () {

        $('#ajaxGridActualResource tbody tr').click(function () {
            // highlight selected row
            $('#ajaxGridActualResource tbody tr').each(
                function () {
                    $(this).removeClass('selected');
                }
            );
            $(this).addClass('selected');

            // Get gen ActualResourceUsageId
            var genActualResourceUsageId = $(this).find('td:first').text();
            var r = confirm("Do you want to edit this row (GenActualResourceId = " + genActualResourceUsageId + ") ?");
            if (r == true) {
                GetEditActualResourceDialog(genActualResourceUsageId);
            }
        });
    });
</script>

<style type="text/css">
#ajaxGridActualResource table tbody tr:hover td
{
    background-color : #fff;
    cursor : pointer;
}
</style>

@{
    var gridTask = new WebGrid(
        Model,
        defaultSort: "Name",
        fieldNamePrefix: "gridActualResource_",
        canSort : false,
        canPage : false
        );
}
<div id="ajaxGridActualResource" >
    <div class="well">
    @if (Model != null && Model.Count() > 0)
    {
        @gridTask.GetHtml(
            tableStyle: "table table-hover",
            //headerStyle: "webgrid-header",
            //footerStyle: "webgrid-footer",
            //alternatingRowStyle: "webgrid-alternating-row",
            //selectedRowStyle: "webgrid-selected-row",
            //rowStyle: "webgrid-row-style",
            columns: gridTask.Columns(
                gridTask.Column("Id", null, @<text>@item.GenActualResourceUsageId</text>),
                                 gridTask.Column("Start Date", "Start Date", @<text>@item.StartDate</text>),
                                 gridTask.Column("End Date", "End Date", @<text>@item.EndDate</text>),
                                gridTask.Column("Clock Off By", "Clock Off By", @<text>@item.ClockOffBy</text>)

                         )
                     )
    }
    </div>
</div>
